<page-header [autoTitle]="false"></page-header>
<nz-card>
  <section class="search-section">
    <nz-select [(ngModel)]="parentId" [nzPlaceHolder]="'操作渠道'" class="search-item" [nzAllowClear]="true" [nzShowSearch]="true">
      <nz-option
        *ngFor="let option of allAgent"
        [nzLabel]="option.name"
        [nzValue]="option.id">
      </nz-option>
    </nz-select>
    <nz-select [(ngModel)]="childId" [nzPlaceHolder]="'升级渠道'" class="search-item" [nzAllowClear]="true" [nzShowSearch]="true">
      <nz-option
        *ngFor="let option of allAgent"
        [nzLabel]="option.name"
        [nzValue]="option.id">
      </nz-option>
    </nz-select>
    <button nz-button [nzType]="'primary'" nzGhost (click)="search()"  class="search-item">
      <i class="anticon anticon-search"></i><span>搜索</span>
    </button>
  </section>
  <nz-table #nzTable [nzData]="page.content"
            [nzPageSize]="page.size"
            [nzTotal]="page.totalElements"
            [nzFrontPagination]="false"
            [(nzPageIndex)]="page.number"
            (nzPageIndexChange)="changePageNo($event)"
            [nzLoading]="isLoading">
    <thead>
    <tr>
      <th nz-th><span>序号</span></th>
      <th nz-th><span>操作渠道</span></th>
      <th nz-th><span>升级渠道</span></th>
      <th nz-th><span>新级别</span></th>
      <th nz-th><span>旧级别</span></th>
      <th nz-th><span>修改时间</span></th>
    </tr>
    </thead>
    <tbody>
    <tr *ngFor="let data of nzTable.data;let i=index">
      <td>
        {{i+1}}
      </td>
      <td><span *ngIf="!data.parentId">管理员操作</span><span *ngIf="data.parentId">{{data.parentId|dicsNamePipe:allAgent:"id":"name"}}</span></td>
      <td>{{data.childId|dicsNamePipe:allAgent:"id":"name"}}</td>
      <td>{{data.newLevelId|dicsNamePipe:levelOptions:"id":"name"}}</td>
      <td>{{data.oldLevelId|dicsNamePipe:levelOptions:"id":"name"}}</td>
      <td>{{data.saveDate}}</td>
    </tr>
    </tbody>
  </nz-table>
</nz-card>
